
import 'package:casdon/core/logger/log.dart';
import 'package:casdon/core/network/business_exception.dart';
import 'package:casdon/modules/home/data/api/home_banner_list_api.dart';
import 'package:casdon/modules/home/data/repository/home_repository.dart';


class HomeBannerListUsecase {
  final HomeRepository _repository;

  const HomeBannerListUsecase(this._repository);

  Future<List<ResponseHomeBannerListApi>> execute() async {
    try {
      var ret = await _repository.getHomeBannerList();
      ret ??= [];
      return ret;
    } on BusinessException {
      rethrow;
    } catch (e) {
      Log.e("HomeBannerListUsecase 失败", e.toString(), StackTrace.current);
      throw Exception("HomeBannerListUsecase 失败");
    }
  }
}
